Skip to content

fix(mcpx): delimiter scanner — fix the 9 remaining heuristic false-positive shapes (#3334) - #3339

Merged
dezren39 merged 1 commit into
mainfrom
queue/5015-3334-delimiter-shapes
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5015-3334-delimiter-shapes

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #3334 — all 9 remaining heuristic false-positive shapes in checkSyntaxAndDelimiters (pkgs/mcpx/internal/scripting/validator.go), each with a regression test in TestValidationRegexLiteralsAreOpaque:

  1. new operand — new added to the expression keywords: new /a+/.constructor("x") opens the regex instead of reading the slash as division.
  2. Class heritage object literal — a { inside a class heritage expression at expression position (or nested in one) is tracked via heritageBraceDepth and no longer consumes the pending body frame; operand closers (>, ), ]) still read as the body (class C<T> {}, extends mixin() {} — the former caught as a regression during this work and covered by the existing test).
  3. Newline frame cleanup scope — the debugger/break/continue ASI newline now clears only frames in its own scope (same filter as ;), so function(a = () => {debugger\n}) {} / 2 keeps the outer frame.
  4. Spread across trivia — spread is tracked as a run of significant . tokens (dotRun), so {... /*c*/ {} / 2} classifies the brace as the spread operand even with a comment intervening.
  5. Line break through comments — comment characters/opener no longer consume lineBreakPending: n\n/*comment*/++ /a+/ reads ++ as a prefix.
  6. Unicode identifier escapes — \u{61} and \u0061 are consumed as identifier characters (neutral placeholder, so an escaped spelling never forms a keyword); their braces are not delimiters.
  7. TS instantiation expressions — narrow speculative recognition (looksLikeInstantiation): a balanced, type-shaped <...> after an operand containing a primitive or capitalised type name, followed by an operand-follower token, completes the operand at >. Lowercase-only generics (f<foo> / 2) are documented in code as a pinned blind spot — locally indistinguishable from a relational chain.
  8. Private names — #name is an operand fragment and every keyword guard now also excludes lastIdentPrev == '#' (mirroring the member-access . guard): this.#return / 2 divides.
  9. Object property named import/export — the module-declaration activation now applies the same next-token property guard as function/class (:, ,, }, )), so { import: "foo"\n / 2 } no longer marks the string as a module specifier.

Verification: go test ./internal/scripting/ -count=1 passes on the laptop (all 105 TestValidationRegexLiteralsAreOpaque subtests incl. the 12 new ones, plus the invalid-shape controls); division controls (a / b / c, x /= 2, unclosed delimiter/string after division) unchanged. gofmt clean.

Queue task 5015 (lane D). Cross-repo note: mcpx also lives in dezren39/nix — this scanner file's nix counterpart should be checked by the follow-up route if it carries the same validator; this PR is code-only per the task packet's scope.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…sitive shapes (#3334)

new operand keyword; class heritage object literal no longer consumes the body frame; debugger/break/continue newline cleanup scoped to its own statement; spread token tracked across trivia; line-break-pending survives comments; \u{...}/\uXXXX identifier escapes consumed as identifier chars; narrow TypeScript instantiation-expression recognition (primitive/capitalised type names, lowercase generics pinned as a blind spot in code); #private names never keyword-classified; import/export as object property names no longer activate module-declaration state. Regression test per shape; division controls unchanged.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 04:58
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9787f672-2633-4461-bd5e-6dc5cbdfa645
Commits

Reviewing files that changed from the base of the PR and between a8189c2 and 27c8ea3.

Files selected for processing: 2
  • pkgs/mcpx/internal/scripting/scripting_test.go
  • pkgs/mcpx/internal/scripting/validator.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T05:03:16.260167Z 27c8ea3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27c8ea3051

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx(scripting): delimiter scanner remaining heuristic false-positive shapes (follow-up to #1659)

1 participant